<ui:composition template="/WEB-INF/templates/showcase.xhtml" xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core" 
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" 
	xmlns:o="http://omnifaces.org/ui"
>
	<ui:define name="description">
		<p>
			The	<code>&lt;o:param&gt;</code> extends the standard <code>&lt;f:param&gt;</code> to implement <code>ValueHolder</code>
			and thus support a <code>Converter</code> to convert the supplied value to string, if necessary.
		</p>
		<p>
			You can use it the same way as <code>&lt;f:param&gt;</code>, you only need to change <code>f:</code> into
			<code>o:</code> to get the extra support for a <code>Converter</code> by usual means via the <code>converter</code>
			attribute of the tag, or the nested <code>&lt;f:converter&gt;</code> tag, or just automatically if a converter is
			already registered for the target class via e.g. <code>@FacesConverter(forClass)</code>.
		</p>
		<p>
			Also, if no value is specified, but children are present, then the encoded output of children will be returned as
			value. This is useful when you want to supply JSF components or HTML as parameter of an unescaped
			<code>&lt;h:outputFormat&gt;</code>. For example,
		</p>
		<pre class="prettyprint"><code class="lang-xhtml">
&lt;h:outputFormat value="\#{bundle.paragraph}" escape="false"&gt;
    &lt;o:param&gt;&lt;h:link outcome="contact" value="\#{bundle.contact}" /&gt;&lt;/o:param&gt;
&lt;/h:outputFormat&gt;
		</code></pre>
		<p>
			with this bundle
		</p>
		<pre><code>
paragraph = Please {0} for more information.
contact = contact us
		</code></pre>
		<p>
			will result in the link being actually encoded as output format parameter value.
		</p>
	</ui:define>

	<ui:define name="demo">
		<h3>Using converter</h3>
		<p>
			We want to pass this example entity referenced by <code>\#{paramBean.exampleEntity}</code> as request parameter:
			<strong>#{paramBean.exampleEntity}</strong>
		</p>
		<p>
			<h:link value="f:param, check the link URL, it's merely printing the example entity's toString()">
				<f:param name="exampleEntity" value="#{paramBean.exampleEntity}" />
			</h:link>
		</p>
		<p>
			<h:link value="o:param with converter, the param in the link URL represents the converted value">
				<o:param name="exampleEntity" value="#{paramBean.exampleEntity}" converter="exampleEntityConverter" />
			</h:link>
		</p>
		<p>
			We could of course also have used <code>\#{paramBean.exampleEntity.id}</code> as param value, but this is not
			DRY if you already have a converter for the entity and this is thus potentially maintenance-unfriendly.
		</p>
		
		<h3>Using JSF and HTML as param value</h3>
		<p>
			<f:loadBundle basename="org.omnifaces.showcase.i18n.text" var="text" />
			<o:outputFormat value="#{text['showcase.components.param.demo.whatsnew.link']}" var="_link">
				<f:param value="#{_omniFacesVersion}" />
			</o:outputFormat>
			<h:outputFormat value="#{text['showcase.components.param.demo.whatsnew']}" escape="false">
				<o:param><h:link outcome="#{text['showcase.whatsnew.outcome']}" value="#{_link}" /></o:param>
			</h:outputFormat>
		</p>
	</ui:define>
</ui:composition>